// Copyright (C) 2002-2008 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h

#ifndef __I_FPS_PARTICLE_EMITTER_H_INCLUDED__
#define __I_FPS_PARTICLE_EMITTER_H_INCLUDED__

#include "../FileSystem/IAttributes.h"
#include "SFpsParticle.h"
#include "Rect.h"

//! Types of built in particle emitters
enum E_FPS_PARTICLE_EMITTER_TYPE
{
	FPS_EPET_BOX,
	FPS_EPET_COUNT
};

//! Names for built in particle emitters
const c8* const FpsParticleEmitterTypeNames[] =
{
	"Box",
	0
};

//! A particle emitter for using with particle systems.
/** A Particle emitter emitts new particles into a particle system.
*/
class IFpsParticleEmitter
{
public:

	//! Prepares an array with new particles to emitt into the system
	//! and returns how much new particles there are.
	//! \param now: Current time.
	//! \param timeSinceLastCall: Time elapsed since last call, in milliseconds.
	//! \param outArray: Pointer which will point to the array with the new
	//! particles to add into the system.
	//! \return Returns amount of new particles in the array. Can be 0.
	virtual s32 emitt(float now, float timeSinceLastCall, SFpsParticle*& outArray) = 0;

	virtual s32 emitt2(float now, int nbParticles, SFpsParticle*& outArray) = 0;

	//! Set direction the emitter emits particles
	virtual void setDirection( const vector2df& newDirection ) = 0;

	//! Set minimum number of particles the emitter emits per second
	virtual void setMinParticlesPerSecond( u32 minPPS ) = 0;

	//! Set maximum number of particles the emitter emits per second
	virtual void setMaxParticlesPerSecond( u32 maxPPS ) = 0;

	//! Set minimum starting color for particles
	virtual void setMinStartColor( const SColor& color ) = 0;

	//! Set maximum starting color for particles
	virtual void setMaxStartColor( const SColor& color ) = 0;

	virtual void setBox( const position2df& center, float radius ) = 0;

	virtual const rectf& getBox() const = 0;

	//! Get direction the emitter emits particles
	virtual const vector2df& getDirection() const = 0;

	//! Get the minimum number of particles the emitter emits per second
	virtual u32 getMinParticlesPerSecond() const = 0;

	//! Get the maximum number of particles the emitter emits per second
	virtual u32 getMaxParticlesPerSecond() const = 0;

	//! Get the minimum starting color for particles
	virtual const SColor& getMinStartColor() const = 0;

	//! Get the maximum starting color for particles
	virtual const SColor& getMaxStartColor() const = 0;

	//! Writes attributes of the object.
	//! Implement this to expose the attributes of your scene node animator for
	//! scripting languages, editors, debuggers or xml serialization purposes.
	virtual void serializeAttributes(IAttributes* ou ) const {}

	//! Reads attributes of the object.
	//! Implement this to set the attributes of your scene node animator for
	//! scripting languages, editors, debuggers or xml deserialization purposes.
	//! \param startIndex: start index where to start reading attributes.
	//! \param in: The attributes to work with.
	//! \param options: Additional options.
	//! \return: returns last index of an attribute read by this affector
	virtual s32 deserializeAttributes(s32 startIndex, IAttributes* in) { return 0; }

	//! Get emitter type
	virtual E_FPS_PARTICLE_EMITTER_TYPE getType() const { return FPS_EPET_BOX; }

	//! Reset Emitter
	virtual void Reset()	{}
};

typedef IFpsParticleEmitter IParticleBoxEmitter;

#endif

